var e = getApp();

Page({
    data: {
        memberInfo: {},
        newGoodList: [],
        page: 1,
        finished: !1
    },
    onLoad: function(e) {},
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        }), wx.setNavigationBarTitle({
            title: "我的课程"
        }), this._getData(), this.getRecommendData();
    },
    _getData: function(t) {
        var a = this;
        e._getNetWork({
            url: e.getNetAddresss("plugin.video-demand.api.video-demand-member.get-member-data"),
            success: function(e) {
                if (1 == e.data.result) {
                    var n = e.data.data;
                    a.setData({
                        memberInfo: n
                    }), t && t(e);
                } else console.error(e);
            },
            fail: function(e) {
                console.error(e);
            }
        });
    },
    toNext: function(e) {
        var t = e.currentTarget.dataset.item;
        wx.navigateTo({
            url: "/packageA/member/course/" + t + "/" + t
        });
    },
    toCourse: function(e) {
        var t = e.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + t
        });
    },
    getRecommendData: function() {
        var t = this;
        if (!this.data.finished) {
            var a = e.getNetAddresss("plugin.video-demand.api.video-demand-member.get-recommend-goods");
            e._getNetWork({
                url: a,
                data: {
                    page: this.data.page
                },
                success: function(e) {
                    if (1 !== e.data.result) return wx.showToast({
                        title: e.data.msg
                    }), !1;
                    var a, n = e.data.data, o = !1;
                    (0 === n.data.length || n.data.length < n.per_page || n.current_page === n.last_page) && (o = !0), 
                    a = t.data.newGoodList.concat(n.data), t.setData({
                        finished: o,
                        newGoodList: a,
                        page: ++t.data.page
                    });
                }
            });
        }
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        console.log(111111111), this.getRecommendData();
    },
    onShareAppMessage: function() {}
});